﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibNoise.Model {
	public class Plane {
        /// A pointer to the noise module used to generate the output values.
        private ModuleBase m_pModule;

        /// Constructor.
		public Plane() {
			m_pModule = null;
		}

        /// Constructor
        ///
        /// @param module The noise module that is used to generate the output
        /// values.
		public Plane(ModuleBase module) {
			m_pModule = module;
		}

        /// Returns the noise module that is used to generate the output
        /// values.
        ///
        /// @returns A reference to the noise module.
        ///
        /// @pre A noise module was passed to the SetModule() method.
        public ModuleBase GetModule()
        {
			return m_pModule;
        }

        /// Returns the output value from the noise module given the
        /// ( @a x, @a z ) coordinates of the specified input value located
        /// on the surface of the plane.
        ///
        /// @param x The @a x coordinate of the input value.
        /// @param z The @a z coordinate of the input value.
        ///
        /// @returns The output value from the noise module.
        ///
        /// @pre A noise module was passed to the SetModule() method.
        ///
        /// This output value is generated by the noise module passed to the
        /// SetModule() method.
		public double GetValue(double x, double z) {
			return m_pModule.GetValue(x, 0, z);
		}

        /// Sets the noise module that is used to generate the output values.
        ///
        /// @param module The noise module that is used to generate the output
        /// values.
        ///
        /// This noise module must exist for the lifetime of this object,
        /// until you pass a new noise module to this method.
        public void SetModule(ModuleBase module)
        {
			m_pModule = module;
        }
	}
}
